//  - main处理函数
exports.main = (req,res) =>{
    var bind = req.bind;
    const tool = require(bind.dir+'/module/emma.js');
    var HTML = tool.require('html');
    var h = new HTML();
    h.isMobile(req,tool);
    h.load({'title':'httpbin || '+Math.random()*100000,'css':'/public/httpbin','js':'/public/jquery-1.12.4.min'});
    h.appHead('<meta charset="utf-8">');
    var html = '';
    var reqHdStr = '',json = {},
    hds = req.headers;
    for(var k in hds){
        reqHdStr += '<li>'+k+' : '+hds[k]+'</li>';
    }
    if(reqHdStr) reqHdStr = '<ul>'+reqHdStr+'</ul>';
    html += reqHdStr;
    if(bind['method']){
        var fmdata = '';
        json = bind['__'+bind['method']];
        for(var k in json){
            fmdata += '<li>'+k+' : '+json[k]+'</li>';
        }
        if(fmdata) html += '<h4>表单请求数据('+bind['method']+')</h4><ul>'+fmdata+'</ul>';
    }
    h.appBody(html);
    res.write(h.getHtml());
    //console.log(res);
}